package com.jial08.designpatterns.factory.factory;

import com.jial08.designpatterns.factory.factory.factory.AddFactory;
import com.jial08.designpatterns.factory.factory.factory.MulFactory;

/**
 * <p>类描述：。</p>
 *
 * @author jl
 * @version v1.0.0.1。
 * @since JDK1.8。
 * <p>创建日期：2019/10/19 上午10:21。</p>
 */
public class Demo {
	public static void main(String[] args) {
		IFactory iFactory = new AddFactory();
		Operation operation = iFactory.createOperation();
		try {
			double result = operation.getResult(1, 2);
			System.out.println(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
		iFactory = new MulFactory();
		operation = iFactory.createOperation();
		try {
			double result = operation.getResult(1, 2);
			System.out.println(result);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
